<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>在Ubuntu上编译安装FreeSWITCH | 澹台灭明的博客</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="上次记录了miniSIPServer配置，如果没有特殊需求或者不想涉及过多SIP内容，其实miniSIPServer是个不错的选择。对于开源的openSIPS和FreeSWITCH，两者其实系出同门，相比而言，FreeSWITCH作为后起之秀，配置文件均使用XML，相对于openSIPS的配置文件更容易上手，因此最终采用了FreeSWITCH作为项目服务器。 FreeSWITCH简介FreeSWI">
<meta name="keywords" content="Ubuntu,SIP,FreeSWITCH">
<meta property="og:type" content="article">
<meta property="og:title" content="在Ubuntu上编译安装FreeSWITCH">
<meta property="og:url" content="http://hitfyd.gitee.com/2017/11/27/在Ubuntu上编译安装FreeSWITCH/index.html">
<meta property="og:site_name" content="澹台灭明的博客">
<meta property="og:description" content="上次记录了miniSIPServer配置，如果没有特殊需求或者不想涉及过多SIP内容，其实miniSIPServer是个不错的选择。对于开源的openSIPS和FreeSWITCH，两者其实系出同门，相比而言，FreeSWITCH作为后起之秀，配置文件均使用XML，相对于openSIPS的配置文件更容易上手，因此最终采用了FreeSWITCH作为项目服务器。 FreeSWITCH简介FreeSWI">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://hitfyd.gitee.com/2017/11/27/在Ubuntu上编译安装FreeSWITCH/make成功.jpg">
<meta property="og:updated_time" content="2017-11-28T06:01:50.267Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="在Ubuntu上编译安装FreeSWITCH">
<meta name="twitter:description" content="上次记录了miniSIPServer配置，如果没有特殊需求或者不想涉及过多SIP内容，其实miniSIPServer是个不错的选择。对于开源的openSIPS和FreeSWITCH，两者其实系出同门，相比而言，FreeSWITCH作为后起之秀，配置文件均使用XML，相对于openSIPS的配置文件更容易上手，因此最终采用了FreeSWITCH作为项目服务器。 FreeSWITCH简介FreeSWI">
<meta name="twitter:image" content="http://hitfyd.gitee.com/2017/11/27/在Ubuntu上编译安装FreeSWITCH/make成功.jpg">
  
    <link rel="alternate" href="/atom.xml" title="澹台灭明的博客" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">澹台灭明的博客</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/" id="subtitle">以貌取人，失之子羽。</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="搜索"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://hitfyd.gitee.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-在Ubuntu上编译安装FreeSWITCH" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2017/11/27/在Ubuntu上编译安装FreeSWITCH/" class="article-date">
  <time datetime="2017-11-27T12:14:03.000Z" itemprop="datePublished">2017-11-27</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/Learn/">Learn</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      在Ubuntu上编译安装FreeSWITCH
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>上次记录了miniSIPServer配置，如果没有特殊需求或者不想涉及过多SIP内容，其实miniSIPServer是个不错的选择。<br>对于开源的openSIPS和FreeSWITCH，两者其实系出同门，相比而言，FreeSWITCH作为后起之秀，配置文件均使用XML，相对于openSIPS的配置文件更容易上手，因此最终采用了FreeSWITCH作为项目服务器。</p>
<h1 id="FreeSWITCH简介"><a href="#FreeSWITCH简介" class="headerlink" title="FreeSWITCH简介"></a>FreeSWITCH简介</h1><p>FreeSWITCH是一个开源的电话软交换平台，主要开发语言是C，以MPL1.1发布。<br>关于更多FreeSWITCH信息可以参考FreeSWITCH中文站：<a href="http://www.freeswitch.org.cn" target="_blank" rel="external">http://www.freeswitch.org.cn</a> 或者阅读《FreeSWITCH权威指南》。</p>
<h1 id="FreeSWITCH编译"><a href="#FreeSWITCH编译" class="headerlink" title="FreeSWITCH编译"></a>FreeSWITCH编译</h1><h2 id="通用步骤"><a href="#通用步骤" class="headerlink" title="通用步骤"></a>通用步骤</h2><h3 id="下载源码"><a href="#下载源码" class="headerlink" title="下载源码"></a>下载源码</h3><p>Git代码库：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">git clone https://freeswitch.org/stash/scm/fs/freeswitch.git</div></pre></td></tr></table></figure></p>
<p>wget下载：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">wget http://files.freeswitch.org/freeswitch-releases/freeswitch-1.6.19.tar.xz</div></pre></td></tr></table></figure></p>
<h3 id="安装依赖库"><a href="#安装依赖库" class="headerlink" title="安装依赖库"></a>安装依赖库</h3><p>在不同的平台上，依赖不同的包，如：</p>
<p>CentOS:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">yum install -y subversion autoconf automake libtool gcc-c++ ncurses-devel make</div></pre></td></tr></table></figure></p>
<p>Ubuntu:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">sudo apt-get -y install build-essential subversion automake autoconf wget libtool libncurses5-dev</div><div class="line">//可能需要很多依赖包，这是另一个版本，都安装一下</div><div class="line">sudo apt-get install -y autoconf git libtool g++ zlib1g-dev  libjpeg-dev libsqlite3-dev  libcurl4-openssl-dev libpcre3-dev libspeex-dev  libspeexdsp-dev  libldns-dev libedit-dev libssl-dev  pkg-config yasm liblua5.2-dev libopus-dev libsndfile-dev libpq-dev pkg-config</div><div class="line">//缺少可能会出错的依赖包，也要安装</div><div class="line">sudo apt-get install libtiff4-dev</div></pre></td></tr></table></figure></p>
<p>完整依赖库需要参考 <a href="http://www.freeswitch.org.cn/Makefile" target="_blank" rel="external">http://www.freeswitch.org.cn/Makefile</a> ， 以确定平台上应该安装哪些包。</p>
<h3 id="编译安装的一般步骤"><a href="#编译安装的一般步骤" class="headerlink" title="编译安装的一般步骤"></a>编译安装的一般步骤</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">./bootstrap.sh   #如果下载的是tar包则省略这一步</div><div class="line">./configure</div><div class="line">make</div><div class="line">make install</div></pre></td></tr></table></figure>
<p>这里的每一步都需要运行很长时间，可能因为环境依赖问题报错停止，请耐心排查，参见<strong>编译问题</strong>。</p>
<h2 id="一条命令"><a href="#一条命令" class="headerlink" title="一条命令"></a>一条命令</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">cd /tmp &amp;&amp; wget http://www.freeswitch.org.cn/Makefile &amp;&amp; make</div></pre></td></tr></table></figure>
<p>通常会由于各种依赖库问题失败，所以还是老老实实按照通用步骤一步一步来吧。<br>注：如果实现安装了各种依赖库，有可能成功。</p>
<h2 id="编译问题"><a href="#编译问题" class="headerlink" title="编译问题"></a>编译问题</h2><p>好了，由于各种依赖库问题，下面进入填坑阶段。我的编译环境为<strong>Ubuntu Server 14.04 32位</strong>系统。</p>
<h3 id="运行-configure命令出错"><a href="#运行-configure命令出错" class="headerlink" title="运行./configure命令出错"></a>运行<em>./configure</em>命令出错</h3><p><em>./bootstrap.sh</em>命令通常不会出错，在运行<em>./configure</em>命令出错如下：</p>
<h4 id="安装libtiff4-dev"><a href="#安装libtiff4-dev" class="headerlink" title="安装libtiff4-dev"></a>安装libtiff4-dev</h4><p>出错如下：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">configure: error: &quot;Cannot build without libtiff (does your system require a libtiff-devel package?)&quot;</div><div class="line">configure: error: ./configure.gnu failed for libs/spandsp</div></pre></td></tr></table></figure></p>
<p>解决：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">sudo apt-get install libtiff4-dev</div></pre></td></tr></table></figure></p>
<p>重新运行<em>./configure</em>命令。</p>
<h3 id="运行make命令出错"><a href="#运行make命令出错" class="headerlink" title="运行make命令出错"></a>运行<em>make</em>命令出错</h3><p>出现一下情况就是<em>make</em>成功了！</p>
<img src="/2017/11/27/在Ubuntu上编译安装FreeSWITCH/make成功.jpg" title="我们的征途是星辰大海！">
<h3 id="其它错误请自行百度！"><a href="#其它错误请自行百度！" class="headerlink" title="其它错误请自行百度！"></a>其它错误请自行百度！</h3><h1 id="运行FreeSWITCH"><a href="#运行FreeSWITCH" class="headerlink" title="运行FreeSWITCH"></a>运行FreeSWITCH</h1><h2 id="添加命令链接"><a href="#添加命令链接" class="headerlink" title="添加命令链接"></a>添加命令链接</h2><p>FreeSWITCH在UNIX类操作系统上默认安装位置是/usr/local/freeswitch，两个常用命令是/usr/local/freeswitch/bin/freeswitch(启动freeswitch服务器)和/usr/local/freeswitch/bin/fs_cli(命令控制台)，因此将它们加入到搜索路径中，方便使用。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/</div><div class="line">ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/</div></pre></td></tr></table></figure></p>
<h2 id="启动服务器"><a href="#启动服务器" class="headerlink" title="启动服务器"></a>启动服务器</h2><p>如果不想在前台启动freeswitch，可以将其启动在后台并通过fs_cli进行管理。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">freeswitch -nc</div><div class="line">fs_cli</div></pre></td></tr></table></figure></p>
<p>退出fs_cli控制台可以输入/exit或按Ctrl+D组合键。</p>
<h2 id="停止服务器"><a href="#停止服务器" class="headerlink" title="停止服务器"></a>停止服务器</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">freeswitch -stop</div></pre></td></tr></table></figure>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://hitfyd.gitee.com/2017/11/27/在Ubuntu上编译安装FreeSWITCH/" data-id="cjai5buzy00051ov4vclzcapa" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/FreeSWITCH/">FreeSWITCH</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/SIP/">SIP</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Ubuntu/">Ubuntu</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2018/05/08/PJSIP Android编译/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          PJSIP Android编译
        
      </div>
    </a>
  
  
    <a href="/2017/11/25/在云主机上安装、部署和调试miniSIPServer/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">在云主机上安装、部署和调试miniSIPServer</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">分类</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Learn/">Learn</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Tool/">Tool</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/拾遗/">拾遗</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Android/">Android</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/FreeSWITCH/">FreeSWITCH</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Hexo/">Hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/PJSIP/">PJSIP</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/SIP/">SIP</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Ubuntu/">Ubuntu</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/miniSIPServer/">miniSIPServer</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/云主机/">云主机</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签云</h3>
    <div class="widget tagcloud">
      <a href="/tags/Android/" style="font-size: 10px;">Android</a> <a href="/tags/FreeSWITCH/" style="font-size: 10px;">FreeSWITCH</a> <a href="/tags/Hexo/" style="font-size: 10px;">Hexo</a> <a href="/tags/PJSIP/" style="font-size: 10px;">PJSIP</a> <a href="/tags/SIP/" style="font-size: 15px;">SIP</a> <a href="/tags/Ubuntu/" style="font-size: 20px;">Ubuntu</a> <a href="/tags/miniSIPServer/" style="font-size: 10px;">miniSIPServer</a> <a href="/tags/云主机/" style="font-size: 15px;">云主机</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/05/">五月 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/11/">十一月 2017</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2018/05/08/PJSIP Android编译/">PJSIP Android编译</a>
          </li>
        
          <li>
            <a href="/2017/11/27/在Ubuntu上编译安装FreeSWITCH/">在Ubuntu上编译安装FreeSWITCH</a>
          </li>
        
          <li>
            <a href="/2017/11/25/在云主机上安装、部署和调试miniSIPServer/">在云主机上安装、部署和调试miniSIPServer</a>
          </li>
        
          <li>
            <a href="/2017/11/08/云主机价格比较/">云主机价格比较</a>
          </li>
        
          <li>
            <a href="/2017/11/07/Hexo学习/">Hexo学习</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2018 hitfyd@foxmail.com<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>